{template header}

<div class="container">

    <ol class="breadcrumb">
        <li><a href="{SITE_URL}">首页</a></li>
        <li><a href="{tsUrl('article')}">文档</a></li>


        <li>{if $strArticle['group']}<a href="{tsUrl('group','show',array('id'=>$strArticle['group']['groupid']))}">{$strArticle['group']['groupname']}</a>{else}广播{/if}</li>


    </ol>

    <div class="row">

        <div class="col-md-8">

            <div class="panel panel-default">
                <div class="panel-body">

                    <div class="page-header">
                        <h1>{$strArticle[title]}</h1>
                    </div>


                    <div class="media mb20">

                        <a class="pull-left" href="{tsUrl('user','article',array('id'=>$strArticle[user][userid],'groupid'=>$strArticle[groupid]))}"><img class="media-object img-circle" title="{$strArticle[user][username]}" alt="{$strArticle[user][username]}" src="{$strArticle[user][face]}" width="48" height="48"></a>
                        {if $TS_USER[userid]&&$strArticle[userid]!=$TS_USER[userid]}
                        <a class="pull-right" href="javascript:void('0');" onclick="recommend({$strArticle[articleid]})">{if $isRecommend==0}<i class="fa fa-heart-o"></i> 赞{else}<i class="fa fa-heart"></i> 取消{/if}</a>
                        {/if}
                        <div class="media-body">
                            <h4 class="media-heading"><a href="{tsUrl('user','article',array('id'=>$strArticle[userid],'groupid'=>$strArticle[groupid]))}">{$strArticle[user][username]}</a></h4>
                            <p class="c9">发表于{php echo getTime($strArticle[addtime],time())}</p>
                        </div>
                    </div>

                    {if $strArticle['tags']}
                    <div class="tags">
                        {loop $strArticle[tags] $key $item} <a
                            href="{tsUrl('article','tag',array('id'=>$item['tagname']))}">{$item[tagname]}</a>
                        {/loop}
                    </div>
                    <div class="clear"></div>
                    {/if}

                    {if $strArticle['duty']}
                     <div style="margin-bottom:20px;padding: 20px 10px 20px 10px;background-color: #F0F0EE;border-radius:25px;">
                         {if $strArticle['duty']['endtime']==0}{php echo date('Y-m-d',$strArticle['duty']['begintime'])}{else}{php echo date('Y-m-d H:i',$strArticle['duty']['begintime'])}至{php echo date('H:i',$strArticle['duty']['endtime'])}{/if}服务{if $strArticle['duty']['commute']==0}{php echo $strArticle['duty']['term']}小时{else}，通勤时间{php echo $strArticle['duty']['commute']}小时，合计耗时{php echo $strArticle['duty']['term']}小时{/if}，{php echo $strArticle['duty']['job']}&nbsp;&nbsp;
                     </div>
                    {/if}



                    <div class="article-content">
                        <div class="article-view">
                        {php doAction('gobad','content_top')}
                        {$strArticle[content]}

                        {$tpUrl}

                        {php doAction('gobad','468')}
                        </div>
                    </div>

                    <div class="tar c9">
                        {$strArticle['count_view']} 阅读 | {$strArticle['count_comment']} 评论 | {$strArticle['count_recommend']} 赞
                    </div>
                    <div class="tar pd100" style="{if isMobile()}display:flex;justify-content:space-between;{else}float:right;{/if}padding-top: 5px">
                    {if $TS_USER[isadmin]==1||$strArticle['userid']==$TS_USER['userid']}

                        <a class="btn btn-w" style="width: 65px" href="{SITE_URL}index.php?app=article&ac=edit&articleid={$strArticle[articleid]}">修改</a>
                        <a class="btn btn-w" style="width: 65px" href="{SITE_URL}index.php?app=article&ac=delete&articleid={$strArticle[articleid]}&token={$_SESSION['token']}"  onClick="return confirm('确定删除吗?')">删除</a>

                    {/if}
                        {if $TS_USER[isadmin]==1}
                        <a class="btn btn-w" style="width: 65px" href="javascript:void('0');" onclick="tsPost('index.php?app=group&ac=ajax&ts=isdes&js=1',{'articleid':'{$strArticle['articleid']}'})">{if $strArticle['isdes']}取消描述{else}设为描述{/if}</a>
                       {if $strArticle['groupid']}
                        <a class="btn btn-w" style="width: 65px" href="{SITE_URL}index.php?app=group&ac=do&ts=article_istop&articleid={$strArticle[articleid]}">{if $strArticle[istop]=='0'}置顶{else}解置{/if}</a>
                        {/if}
                        {/if}
                    </div>
                    <!--
                    <nav>
                        <ul class="pager">
                            {if $strUp}
                            <li><a href="{tsUrl('article','show',array('id'=>$strUp['articleid']))}{$mylink}">上一篇：{$strUp['title']}</a></li>
                            {/if}
                            {if $strNext}
                            <li><a href="{tsUrl('article','show',array('id'=>$strNext['articleid']))}{$mylink}">下一篇：{$strNext['title']}</a></li>
                            {/if}
                        </ul>
                    </nav>-->
                    {if isMobile()}
                    <div class="tar pd100" style="text-align: center;padding-top: 10px;padding-bottom: 10px;display:flex;justify-content:space-between;">

                        <span><a class="btn btn-success" href="javascript:if(confirm('确实要报名馆员吗?'))location='{if $strArticle['groupid']}{tsUrl('group','join',array('groupid'=>$strArticle['groupid'],'jointype'=>1))}{else}{tsUrl('group','index',array('all'=>1,'type'=>2))}{/if}'">报名馆员参加服务</a></span>
                        <span><a class="btn btn-success" href="javascript:if(confirm('确实要报名馆东吗?'))location='{if $strArticle['groupid']}{tsUrl('group','join',array('groupid'=>$strArticle['groupid'],'jointype'=>3))}{else}{tsUrl('group','index',array('all'=>1,'type'=>1))}{/if}'">报名月捐成为馆东</a></span>

                    </div>
                    {/if}

                </div>
            </div>


            <div class="panel panel-default">
                <div class="panel-heading">你的回应</div>
                <div class="panel-body">

                    {if $arrComment}
                    <div class="comment">
                        <ul>
                            {loop $arrComment $key $item}
                            <li class="clearfix">
                                <div class="user-face">
                                    <a
                                            href="{tsUrl('user','duty',array('id'=>$item[user][userid]))}"><img  title="{$item[user][username]}" alt="{$item[user][username]}"  src="{$item[user][face]}" width="48" /></a>
                                </div>
                                <div class="reply-doc">
                                    <h4>
                                        {php echo date('Y-m-d H:i:s',$item[addtime])} <a
                                            href="{tsUrl('user','duty',array('id'=>$item[userid]))}">{$item[user][username]}</a>
                                    </h4>
                                    {if $item[referid] !='0'}
                                    <div class="recomment"><a href="{tsUrl('user','duty',array('id'=>$item[recomment][user][userid]))}"><img src="{$item[recomment][user][face]}" width="24" align="absmiddle"></a> <strong><a href="{tsUrl('user','article',array('id'=>$item[recomment][user][userid]))}" rel="face" uid="$item[recomment][user][userid]">{$item[recomment][user][username]}</a></strong>：{$item[recomment][content]}</div>
                                    {/if}

                                    <p>{$item[content]}</p>

                                    <div class="tar">
                                        {if intval($TS_USER[userid])>0}
                                             <span><a href="javascript:void(0)"  onclick="commentOpen({$item[commentid]},{$item[articleid]})">回复</a></span>
                                        {/if}
                                        {if $TS_USER[userid] == $item[userid] || $TS_USER['isadmin']==1}
									        <span><a class="j a_confirm_link" href="{SITE_URL}index.php?app=article&ac=comment&ts=delete&commentid={$item['commentid']}"  rel="nofollow">删除</a> </span>
                                        {/if}
                                    </div>
                                    <div id="rcomment_{$item[commentid]}" style="display:none">
                                        <textarea style="width:90%;height:60px;font-size:14px;" id="recontent_{$item[commentid]}" type="text" onKeyDown="keyRecomment({$item[commentid]},{$item[articleid]},event)"></textarea>

                                        <p><a class="btn" href="javascript:void(0);" onClick="recomment({$item[commentid]},{$item[articleid]},'{$_SESSION[token]}')" id="recomm_btn_$item[commentid]">提交</a> <a href="javascript:void('0');" onclick="commentOpen({$item['commentid']},{$item['articleid']})">取消</a></p>
                                    </div>

                                </div>
                            </li> {/loop}
                        </ul>
                    </div>
                    <div class="page">{$pageUrl}</div>
                    {/if}



                    <div>
                        {if intval($TS_USER[userid])==0}
                        <div class="pd20 tac">
                            <a href="https://open.weixin.qq.com/connect/qrconnect?appid=wxf6e6fe0c93b70865&redirect_uri=http%3A%2F%2Fpark.xingongmin.org.cn%2Findex.php%3Fapp%3Dpubs%26ac%3Dplugin%26plugin%3Dweixin%26in%3Dcallback&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect">登录</a>
                        </div>
                        {else}
                        <form method="POST"
                              action=""
                              onSubmit="return submitonce(this)" id="formMini">
                            <div class="wangeditor_toolbar" id="tseditor"></div>
                            <div class="wangeditor_text" id="tseditor2"></div>
                            <div style="display: none"><textarea id="content" name="content"></textarea></div>
                            <br />
                            <p>
                                <input type="hidden" id="articleid" name="articleid"
                                       value="{$strArticle[articleid]}" /> <input type="hidden"
                                                                                  name="token" value="{$_SESSION['token']}" />

                                <button class="btn btn-success" type="submit">提交评论</button>
                            </p>
                        </form>
                        {/if}
                    </div>


                </div>
            </div>



<!--
            <div class="panel panel-default">
                <div class="panel-heading">最新文档</div>
                <div class="panel-body">

                    <div class="commlist">
                        <ul>
                            {loop $arrArticle $key $item}
                            <li><a href="{tsUrl('article','show',array('id'=>$item['articleid']))}{$mylink}">{$item['title']}</a></li>
                            {/loop}
                        </ul>
                    </div>

                </div>
            </div>-->


        </div>


        <div class="col-md-4">

            <a class="btn btn-info btn-block btn-lg" href="{tsUrl('article','add')}">
                <span class="glyphicon glyphicon-plus-sign"></span> 写文档</a>
            <p></p>

            {php doAction('gobad','topic_right_top')}


            <div class="panel panel-default">
                <div class="panel-heading">文档分组</div>
                <div class="panel-body">

                    <select onchange="jumpto('{tsUrl('article','group')}',this.options[this.options.selectedIndex].value)" name="groupid" id="groupid" class="form-control">
                        <option value="">选择小组</option>
                        {loop $arrGroup $key $item}
                        <option value="{$item['groupid']}" {if $item['groupid']==$groupid}selected{/if}>{$item['groupname']}</option>
                        {/loop}
                    </select>


                </div>

            </div>

<!--
            <div class="panel panel-default">
                <div class="panel-heading">一周热门</div>
                <div class="panel-body">
                    <div class="commlist">
                        <ul>
                            {loop $arrHot7 $key $item}
                            <li><a
                                    href="{tsUrl('article','show',array('id'=>$item['articleid']))}{$mylink}">{$item['title']}</a></li>
                            {/loop}
                        </ul>
                    </div>
                </div>

            </div>

            <div class="panel panel-default">
                <div class="panel-heading">一月热门</div>
                <div class="panel-body">
                    <div class="commlist">
                        <ul>
                            {loop $arrHot30 $key $item}
                            <li><a
                                    href="{tsUrl('article','show',array('id'=>$item['articleid']))}{$mylink}">{$item['title']}</a></li>
                            {/loop}
                        </ul>
                    </div>
                </div>

            </div>-->

            <!--广告位-->
            {php doAction('gobad','300')}
        </div>



    </div>
</div>

<script>

    $(function(){
        $('#formMini').on('submit', function(e) {

            var content  = $('#content').val();
            var articleid = $('#articleid').val();

            //var text = Trim(content);
           // if(text == ''){
               // bootbox.alert('内容不能为空');
              //  return false;
           // }

            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=article&ac=comment&ts=do",
                data: "articleid="+articleid+"&content="+content,
                beforeSend:function(){
                },
                success:function(result){
                    if(result['status'] == 1){
                        window.location.reload();
                    }
                }
            });

        });

    });
</script>
{php doAction('tseditor','mini')}
{template footer}


